let menu = require("./src/menu");
let {File} = require("ada-util");
let Path = require("path");

let app = {
    siteURL: "/",
    sourcePath: "./src/",
    distPath: "./dist/",
    indexPath: "./dist/index.html",
    entryPath: "./src/entries/",
    main: "./src/root.js",
    staticPath: "./src/static",
    baseInfo: {
        name: "test",
        description: "test",
        icons: [],
        charset: "UTF-8",
        meta: [
            {name: 'viewport', content: "width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no"},
            {name: 'format_detection', content: "telephone=no"},
            {name: 'apple_mobile_web_app_status_bar_style', content: "white"},
            {name: 'apple_mobile_web_app_capable', content: "yes"}
        ]
    },
    server: {
        proxy: [
            {
                path: "/api/", option: {
                    target: 'http://39.155.166.62:9023',
                    changeOrigin: true,
                    pathRewrite: {
                        '^/api/lgb/': '/lgb/',
                        '^/api/cms/': '/cms/',
                        '^/api/admin/': '/admin/',
                        '^/api/Kaptcha/': '/Kaptcha/',
                        '^/api/resource/': '/resource/'
                    }
                }
            }
        ]
    },
    indexPaths() {
        return menu.map(item => item.link);
    },
    entryFiles(config) {
        return new File(Path.resolve(config.sourcePath, "./pages")).getAllSubFilePaths().then(paths => {
            return paths.filter(path => Path.basename(path) === "index.js");
        });
    }
};
module.exports = app;